import "./assets/main.scss";
import { createApp } from 'vue'
// 导入pinia
import { createPinia } from "pinia";
//导入持久化插件
import { createPersistedState } from "pinia-persistedstate-plugin";

import App from './App.vue'

// 导入路由
import router from '@/router'

// 引入element-plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
// element-plus国际化
import zhCn from 'element-plus/es/locale/lang/zh-cn'
// element-plus图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)
const pinia = createPinia()
const persist = createPersistedState({
  storage: sessionStorage
})

pinia.use(persist)
app.use(pinia)
app.use(router)
app.use(ElementPlus, {
  locale: zhCn,
})

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.mount('#app')